package com.egoonet.web;

import com.egoonet.domain.Department;
import com.egoonet.dept.Node;
import com.egoonet.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * Created by wchi on 2017/4/22.
 */
@RestController
public class DepartmentController {
    @Autowired
    DepartmentService departmentService;

    @RequestMapping(value="/departments", method = RequestMethod.GET)
    public Node<Department> getAllDepartment(){
        Node<Department> rootDept = departmentService.getRootDepartment();
        return rootDept;
    }
}
